//index.js
const app = getApp()
const { envList } = require('../../envList.js')

Page({
  data: {
    activeSwiperIndex: 0,
    activeTabIndex: 0,
    avatarUrl: './user-unlogin.png',
    userInfo: {},
    hasUserInfo: false,
    logged: false,
    takeSession: false,
    requestResult: '',
    canIUseGetUserProfile: false,
    canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') // 如需尝试获取用户信息可改为false
  },
  doListChange(e) {
    console.log(e);
    let index = e.detail.current
    this.setData({
      activeTabIndex: index
    })
  },
  switchTab(e) {
    let index = e.currentTarget.dataset.index;
    console.log(index);
    if (index == this.data.activeTabIndex){
      return ;
    }
    this.setData({
      activeTabIndex: index,
      activeSwiperIndex: index
    })
  },
  onShow() {
    wx.showLoading({
      title: '加载中'
    })
  },
  onLoad: function() {
    //取数据独立函数
    this.loadData()
  },
  loadData() {
    if (this.data.activeTabIndex == 0) {
      this.loadHot();
    } else {
      this.loadChase();
    }
  },
  loadHot() {

  },
  loadChase() {
    
  },
  onPullDownRefresh() {

  }
})
